//
// Created by Bruce on 11/21/24.
//

#ifndef CAMMULTITHREADDETECTOR_IMAGEGRABBER_HPP
#define CAMMULTITHREADDETECTOR_IMAGEGRABBER_HPP

#pragma once

#include "include/Application/cammultithreaddetector_gloabl_variables.h"

namespace CamMultiThreadDetector{

	namespace Adapter{

		class ImageGrabber : public Pylon::CImageEventHandler
		{
		public:
			ImageGrabber();
			virtual ~ImageGrabber();
			static std::shared_ptr<ImageGrabber> getInstance();
			virtual int setParams(Pylon::CInstantCamera* __pcamera, Application::CameraInstanceName __CameraInstanceName);
			virtual void run();

		private:
			virtual void OnImageGrabbed(Pylon::CInstantCamera& __camera, const Pylon::CGrabResultPtr& __ptrGrabResult);

		private:
			Pylon::CInstantCamera          *m_cameraInstance      = NULL;
			Application::CameraInstanceName m_pCameraInstanceName = Application::CameraInstanceName::CAMERA0;

		public:
			ImageGrabber& operator=(const ImageGrabber& other)
			{
				this->m_cameraInstance      = other.m_cameraInstance;
				this->m_pCameraInstanceName = other.m_pCameraInstanceName;
				return *this;
			}

		}; // class ImageGrabber

	} // namespace Adapter

} // namespace CamMultiThreadDetector

#endif // CAMMULTITHREADDETECTOR_IMAGEGRABBER_HPP
